package com.undeadscythes.udsplugin.utilities;

import com.undeadscythes.udsplugin.HelpFile;
import com.undeadscythes.udsplugin.UDSHashMap;
import com.undeadscythes.udsplugin.UDSItem;
import com.undeadscythes.udsplugin.UDSPlugin;
import com.undeadscythes.udsplugin.commands.*;
import com.undeadscythes.udsplugin.listeners.*;
import java.util.LinkedList;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.PluginManager;

public class InitUtils {
    /**
     * Load list of user friendly names for MC items.
     * @param plugin Instance of running UDSPlugin.
     */
    public static void initItemNames(final UDSHashMap<UDSItem> myItems) {
        myItems.put("White_Wool", new UDSItem("White_Wool", 35, (byte)0));
        myItems.put("Orange_Wool", new UDSItem("Orange_Wool", 35, (byte)1));
        myItems.put("Magenta_Wool", new UDSItem("Magenta_Wool", 35, (byte)2));
        myItems.put("Denim_Wool", new UDSItem("Denim_Wool", 35, (byte)3));
        myItems.put("Yellow_Wool", new UDSItem("Yellow_Wool", 35, (byte)4));
        myItems.put("Lime_Wool", new UDSItem("Lime_Wool", 35, (byte)5));
        myItems.put("Pink_Wool", new UDSItem("Pink_Wool", 35, (byte)6));
        myItems.put("Slate_Wool", new UDSItem("Slate_Wool", 35, (byte)7));
        myItems.put("Gray_Wool", new UDSItem("Gray_Wool", 35, (byte)8));
        myItems.put("Cyan_Wool", new UDSItem("Cyan_Wool", 35, (byte)9));
        myItems.put("Purple_Wool", new UDSItem("Purple_Wool", 35, (byte)10));
        myItems.put("Navy_Wool", new UDSItem("Navy_Wool", 35, (byte)11));
        myItems.put("Brown_Wool", new UDSItem("Brown_Wool", 35, (byte)12));
        myItems.put("Olive_Wool", new UDSItem("Olive_Wool", 35, (byte)13));
        myItems.put("Red_Wool", new UDSItem("Red_Wool", 35, (byte)14));
        myItems.put("Black_Wool", new UDSItem("Black_Wool", 35, (byte)15));
        myItems.put("Ink_Sack", new UDSItem("Ink_Sack", 351, (byte)0));
        myItems.put("Red_Dye", new UDSItem("Red_Dye", 351, (byte)1));
        myItems.put("Cactus_Dye", new UDSItem("Cactus_Dye", 351, (byte)2));
        myItems.put("Cocoa_Beans", new UDSItem("Cocoa_Beans", 351, (byte)3));
        myItems.put("Lapis_Lazuli", new UDSItem("Lapis_Lazuli", 351, (byte)4));
        myItems.put("Purple_Dye", new UDSItem("Purple_Dye", 351, (byte)5));
        myItems.put("Cyan_Dye", new UDSItem("Cyan_Dye", 351, (byte)6));
        myItems.put("Gray_Dye", new UDSItem("Gray_Dye", 351, (byte)7));
        myItems.put("Slate_Dye", new UDSItem("Slate_Dye", 351, (byte)8));
        myItems.put("Pink_Dye", new UDSItem("Pink_Dye", 351, (byte)9));
        myItems.put("Lime_Dye", new UDSItem("Lime_Dye", 351, (byte)10));
        myItems.put("Yellow_Dye", new UDSItem("Yellow_Dye", 351, (byte)11));
        myItems.put("Denim_Dye", new UDSItem("Denim_Dye", 351, (byte)12));
        myItems.put("Magenta_Dye", new UDSItem("Magenta_Dye", 351, (byte)13));
        myItems.put("Orange_Dye", new UDSItem("Orange_Dye", 351, (byte)14));
        myItems.put("Bonemeal", new UDSItem("Bonemeal", 351, (byte)15));
        myItems.put("Chain_Helmet", new UDSItem("Chain_Helmet", 302, (byte)0));
        myItems.put("Chain_Chest", new UDSItem("Chain_Chest", 303, (byte)0));
        myItems.put("Chain_Legs", new UDSItem("Chain_Legs", 304, (byte)0));
        myItems.put("Chain_Boots", new UDSItem("Chain_Boots", 305, (byte)0));
        myItems.put("Milk", new UDSItem("Milk", 335, (byte)0));
        myItems.put("Lantern", new UDSItem("Lantern", 123, (byte)0));
        myItems.put("Mossy_Cobble", new UDSItem("Mossy_Cobble", 48, (byte)0));
        myItems.put("Mycellium", new UDSItem("Mycellium", 110, (byte)0));
        myItems.put("Double_Slab", new UDSItem("Double_Slab", 43, (byte)0));
        myItems.put("Creeper_Block", new UDSItem("Creeper_Block", 24, (byte)1));
        myItems.put("Circle_Block", new UDSItem("Circle_Block", 98, (byte)3));
        myItems.put("Sandstone_Block", new UDSItem("Sandstone_Block", 24, (byte)2));
    }

    /**
     * Adds custom crafting recipes to the server.
     * @param server Server the plugin is running on.
     * @param logger Server logger.
     */
    public static void addRecipes(final Server server, final Logger logger) {
        final ShapedRecipe mossyStoneBrick = new ShapedRecipe(new ItemStack(98, 1, (short) 0, (byte) 1)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.VINE).setIngredient('B', new MaterialData(98, (byte) 0));
        server.addRecipe(mossyStoneBrick);
        final ShapelessRecipe crackedStoneBrick = new ShapelessRecipe(new ItemStack(98, 1, (short) 0, (byte) 2)).addIngredient(Material.WOOD_PICKAXE).addIngredient(new MaterialData(98, (byte) 0));
        server.addRecipe(crackedStoneBrick);
        final ShapedRecipe circleStoneBrick = new ShapedRecipe(new ItemStack(98, 8, (short) 0, (byte) 3)).shape("AAA", "A A", "AAA").setIngredient('A', new MaterialData(98, (byte) 0));
        server.addRecipe(circleStoneBrick);
        final ShapedRecipe mossyCobbleStone = new ShapedRecipe(new ItemStack(48, 1)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.VINE).setIngredient('B', Material.COBBLESTONE);
        server.addRecipe(mossyCobbleStone);
        final ShapedRecipe iceBlock = new ShapedRecipe(new ItemStack(79, 1)).shape(" A ", "ABA", " A ").setIngredient('A', Material.SNOW_BALL).setIngredient('B', Material.WATER_BUCKET);
        server.addRecipe(iceBlock);
        final ShapedRecipe chainHelmet = new ShapedRecipe(new ItemStack(302, 1)).shape("AAA", "A A").setIngredient('A', Material.FLINT);
        server.addRecipe(chainHelmet);
        final ShapedRecipe chainChest = new ShapedRecipe(new ItemStack(303, 1)).shape("A A", "AAA" ,"AAA").setIngredient('A', Material.FLINT);
        server.addRecipe(chainChest);
        final ShapedRecipe chainLegs = new ShapedRecipe(new ItemStack(304, 1)).shape("AAA", "A A", "A A").setIngredient('A', Material.FLINT);
        server.addRecipe(chainLegs);
        final ShapedRecipe chainBoots = new ShapedRecipe(new ItemStack(305, 1)).shape("A A", "A A").setIngredient('A', Material.FLINT);
        server.addRecipe(chainBoots);
        final ShapedRecipe grassBlock = new ShapedRecipe(new ItemStack(Material.GRASS, 1)).shape("A", "B").setIngredient('A', new MaterialData(31, (byte) 1)).setIngredient('B', Material.DIRT);
        server.addRecipe(grassBlock);
        final ShapedRecipe snowLayer = new ShapedRecipe(new ItemStack(Material.SNOW, 1)).shape("AAA").setIngredient('A', Material.SNOW_BALL);
        server.addRecipe(snowLayer);
        final ShapedRecipe creeperEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 50)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.SULPHUR);
        server.addRecipe(creeperEgg);
        final ShapedRecipe skeletonEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 51)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.BONE);
        server.addRecipe(skeletonEgg);
        final ShapedRecipe spiderEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 52)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.SPIDER_EYE);
        server.addRecipe(spiderEgg);
        final ShapedRecipe zombieEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 54)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.ROTTEN_FLESH);
        server.addRecipe(zombieEgg);
        final ShapedRecipe slimeEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 55)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.SLIME_BALL);
        server.addRecipe(slimeEgg);
        final ShapedRecipe ghastEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 56)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.GHAST_TEAR);
        server.addRecipe(ghastEgg);
        final ShapedRecipe pigZombieEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 57)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.GOLD_NUGGET);
        server.addRecipe(pigZombieEgg);
        final ShapedRecipe endermanEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 58)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.ENDER_PEARL);
        server.addRecipe(endermanEgg);
        final ShapedRecipe caveSpiderEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 59)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.STRING);
        server.addRecipe(caveSpiderEgg);
        final ShapedRecipe silverFishEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 60)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.STONE);
        server.addRecipe(silverFishEgg);
        final ShapedRecipe blazeEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 61)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.BLAZE_ROD);
        server.addRecipe(blazeEgg);
        final ShapedRecipe magmaCubeEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 62)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.MAGMA_CREAM);
        server.addRecipe(magmaCubeEgg);
        final ShapedRecipe pigEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 90)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.PORK);
        server.addRecipe(pigEgg);
        final ShapedRecipe sheepEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 91)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.WOOL);
        server.addRecipe(sheepEgg);
        final ShapedRecipe cowEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 92)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.LEATHER);
        server.addRecipe(cowEgg);
        final ShapedRecipe chickenEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 93)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.FEATHER);
        server.addRecipe(chickenEgg);
        final ShapedRecipe squidEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 94)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.INK_SACK);
        server.addRecipe(squidEgg);
        final ShapedRecipe wolfEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 95)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.WHEAT);
        server.addRecipe(wolfEgg);
        final ShapedRecipe mooshroomEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 96)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.RED_MUSHROOM);
        server.addRecipe(mooshroomEgg);
        final ShapedRecipe villagerEgg = new ShapedRecipe(new ItemStack(383, 1, (short) 0, (byte) 120)).shape("AAA", "ABA", "AAA").setIngredient('A', Material.GOLD_BLOCK).setIngredient('B', Material.RED_ROSE);
        server.addRecipe(villagerEgg);
        final ShapedRecipe webBlock = new ShapedRecipe(new ItemStack(Material.WEB)).shape("AAA", "A A", "AAA").setIngredient('A', Material.STRING);
        server.addRecipe(webBlock);
        logger.info("Recipes added.");
    }

    /**
     * Register events with the server.
     * @param plugin Instance of running UDSPlugin.
     * @param pluginManager Server plugin manager.
     * @param logger Server logger.
     */
    public static void registerEvents(final UDSPlugin plugin, final PluginManager pluginManager, final Logger logger) {
        pluginManager.registerEvents(new BlockBreak(), plugin);
        pluginManager.registerEvents(new BlockBurn(), plugin);
        pluginManager.registerEvents(new BlockFade(), plugin);
        pluginManager.registerEvents(new BlockForm(), plugin);
        pluginManager.registerEvents(new BlockFromTo(), plugin);
        pluginManager.registerEvents(new BlockIgnite(), plugin);
        pluginManager.registerEvents(new BlockPhysics(plugin), plugin);
        pluginManager.registerEvents(new BlockPistonExtend(), plugin);
        pluginManager.registerEvents(new BlockPistonRetract(), plugin);
        pluginManager.registerEvents(new BlockPlace(), plugin);
        pluginManager.registerEvents(new BlockRedstone(), plugin);
        pluginManager.registerEvents(new BlockSpread(), plugin);
        pluginManager.registerEvents(new CreatureSpawn(), plugin);
        pluginManager.registerEvents(new EntityBlockForm(), plugin);
        pluginManager.registerEvents(new EntityChangeBlock(), plugin);
        pluginManager.registerEvents(new EntityDamage(), plugin);
        pluginManager.registerEvents(new EntityDamageByEntity(plugin), plugin);
        pluginManager.registerEvents(new EntityDeath(plugin), plugin);
        pluginManager.registerEvents(new EntityExplode(plugin), plugin);
        pluginManager.registerEvents(new EntityInteract(), plugin);
        pluginManager.registerEvents(new InventoryClick(), plugin);
        pluginManager.registerEvents(new InventoryOpen(), plugin);
        pluginManager.registerEvents(new PlayerBucketEmpty(), plugin);
        pluginManager.registerEvents(new AsyncPlayerChat(plugin), plugin);
        pluginManager.registerEvents(new PlayerDeath(plugin), plugin);
        pluginManager.registerEvents(new PlayerInteract(plugin), plugin);
        pluginManager.registerEvents(new PlayerInteractEntity(), plugin);
        pluginManager.registerEvents(new PlayerJoin(plugin), plugin);
        pluginManager.registerEvents(new PlayerPortal(), plugin);
        pluginManager.registerEvents(new PlayerQuit(), plugin);
        pluginManager.registerEvents(new PlayerRespawn(plugin), plugin);
        pluginManager.registerEvents(new SignChange(), plugin);
        pluginManager.registerEvents(new VehicleDestroy(), plugin);
        pluginManager.registerEvents(new VehicleEntityCollision(), plugin);
        pluginManager.registerEvents(new VehicleExit(), plugin);
        logger.info("Events registered.");
    }

    /**
     * Set executors for each UDSPlugin command.
     * @param plugin Instance of running UDSPlugin.
     * @param logger Server logger.
     */
    public static void setExecutors(final UDSPlugin plugin, final Logger logger) {
        plugin.getCommand("a").setExecutor(new ACmd(plugin));
        plugin.getCommand("acceptrules").setExecutor(new AcceptRulesCmd(plugin));
        plugin.getCommand("admin").setExecutor(new AdminCmd(plugin));
        plugin.getCommand("adminme").setExecutor(new AdminMeCmd(plugin));
        plugin.getCommand("back").setExecutor(new BackCmd(plugin));
        plugin.getCommand("ban").setExecutor(new BanCmd(plugin));
        plugin.getCommand("blind").setExecutor(new BlindCmd(plugin));
        plugin.getCommand("bounty").setExecutor(new BountyCmd());
        plugin.getCommand("broadcast").setExecutor(new BroadcastCmd(plugin));
        plugin.getCommand("butcher").setExecutor(new ButcherCmd(plugin));
        plugin.getCommand("c").setExecutor(new CCmd(plugin));
        plugin.getCommand("call").setExecutor(new CallCmd(plugin));
        plugin.getCommand("challenge").setExecutor(new ChallengeCmd(plugin));
        plugin.getCommand("check").setExecutor(new CheckCmd(plugin));
        plugin.getCommand("ci").setExecutor(new CiCmd(plugin));
        plugin.getCommand("city").setExecutor(new CityCmd(plugin));
        plugin.getCommand("clan").setExecutor(new ClanCmd(plugin));
        plugin.getCommand("day").setExecutor(new DayCmd(plugin));
        plugin.getCommand("debug").setExecutor(new DebugCmd(plugin));
        plugin.getCommand("default").setExecutor(new DefaultCmd(plugin));
        plugin.getCommand("delwarp").setExecutor(new DelWarpCmd(plugin));
        plugin.getCommand("enchant").setExecutor(new EnchantCmd(plugin));
        plugin.getCommand("face").setExecutor(new FaceCmd());
        plugin.getCommand("firework").setExecutor(new FireworkCmd(plugin));
        plugin.getCommand("gift").setExecutor(new GiftCmd(plugin));
        plugin.getCommand("giveperm").setExecutor(new GivePermCmd(plugin));
        plugin.getCommand("god").setExecutor(new GodCmd(plugin));
        plugin.getCommand("heal").setExecutor(new HealCmd(plugin));
        plugin.getCommand("help").setExecutor(new HelpCmd(plugin));
        plugin.getCommand("home").setExecutor(new HomeCmd(plugin));
        plugin.getCommand("i").setExecutor(new ICmd(plugin));
        plugin.getCommand("ignore").setExecutor(new IgnoreCmd(plugin));
        plugin.getCommand("invsee").setExecutor(new InvSeeCmd(plugin));
        plugin.getCommand("jail").setExecutor(new JailCmd(plugin));
        plugin.getCommand("kick").setExecutor(new KickCmd(plugin));
        plugin.getCommand("kit").setExecutor(new KitCmd(plugin));
        plugin.getCommand("lockdown").setExecutor(new LockdownCmd(plugin));
        plugin.getCommand("map").setExecutor(new MapCmd(plugin));
        plugin.getCommand("mapdupe").setExecutor(new MapDupeCmd(plugin));
        plugin.getCommand("me").setExecutor(new MeCmd(plugin));
        plugin.getCommand("member").setExecutor(new MemberCmd(plugin));
        plugin.getCommand("mod").setExecutor(new ModCmd(plugin));
        plugin.getCommand("modme").setExecutor(new ModMeCmd(plugin));
        plugin.getCommand("money").setExecutor(new MoneyCmd());
        plugin.getCommand("n").setExecutor(new NCmd(plugin));
        plugin.getCommand("nick").setExecutor(new NickCmd(plugin));
        plugin.getCommand("night").setExecutor(new NightCmd(plugin));
        plugin.getCommand("ownerme").setExecutor(new OwnerMeCmd(plugin));
        plugin.getCommand("p").setExecutor(new PCmd(plugin));
        plugin.getCommand("paybail").setExecutor(new PayBailCmd());
        plugin.getCommand("pet").setExecutor(new PetCmd(plugin));
        plugin.getCommand("powertool").setExecutor(new PowertoolCmd());
        plugin.getCommand("private").setExecutor(new PrivateCmd(plugin));
        plugin.getCommand("resetquarry").setExecutor(new ResetQuarryCmd(plugin));
        plugin.getCommand("r").setExecutor(new RCmd(plugin));
        plugin.getCommand("rain").setExecutor(new RainCmd(plugin));
        plugin.getCommand("region").setExecutor(new RegionCmd(plugin));
        plugin.getCommand("rules").setExecutor(new RulesCmd(plugin));
        plugin.getCommand("scuba").setExecutor(new ScubaCmd(plugin));
        plugin.getCommand("server").setExecutor(new ServerCmd(plugin));
        plugin.getCommand("setarmor").setExecutor(new SetArmorCmd(plugin));
        plugin.getCommand("setperm").setExecutor(new SetPermCmd(plugin));
        plugin.getCommand("setspawn").setExecutor(new SetSpawnCmd(plugin));
        plugin.getCommand("setwarp").setExecutor(new SetWarpCmd(plugin));
        plugin.getCommand("shop").setExecutor(new ShopCmd(plugin));
        plugin.getCommand("signs").setExecutor(new SignsCmd(plugin));
        plugin.getCommand("sit").setExecutor(new SitCmd(plugin));
        plugin.getCommand("spawn").setExecutor(new SpawnCmd(plugin));
        plugin.getCommand("spawner").setExecutor(new SpawnerCmd(plugin));
        plugin.getCommand("stack").setExecutor(new StackCmd(plugin));
        plugin.getCommand("stats").setExecutor(new StatsCmd(plugin));
        plugin.getCommand("storm").setExecutor(new StormCmd(plugin));
        plugin.getCommand("sun").setExecutor(new SunCmd(plugin));
        plugin.getCommand("swearjar").setExecutor(new SwearjarCmd(plugin));
        plugin.getCommand("tp").setExecutor(new TPCmd(plugin));
        plugin.getCommand("tell").setExecutor(new TellCmd(plugin));
        plugin.getCommand("timereset").setExecutor(new TimeResetCmd(plugin));
        plugin.getCommand("tgm").setExecutor(new TGMCmd(plugin));
        plugin.getCommand("ticket").setExecutor(new TicketCmd(plugin));
        plugin.getCommand("udsreload").setExecutor(new UDSReloadCmd(plugin));
        plugin.getCommand("unban").setExecutor(new UnBanCmd(plugin));
        plugin.getCommand("unjail").setExecutor(new UnJailCmd(plugin));
        plugin.getCommand("unnick").setExecutor(new UnNickCmd(plugin));
        plugin.getCommand("vip").setExecutor(new VIPCmd(plugin));
        plugin.getCommand("we").setExecutor(new WECmd(plugin));
        plugin.getCommand("warden").setExecutor(new WardenCmd(plugin));
        plugin.getCommand("warp").setExecutor(new WarpCmd());
        plugin.getCommand("where").setExecutor(new WhereCmd(plugin));
        plugin.getCommand("who").setExecutor(new WhoCmd(plugin));
        plugin.getCommand("whois").setExecutor(new WhoIsCmd(plugin));
        plugin.getCommand("xp").setExecutor(new XPCmd(plugin));
        plugin.getCommand("y").setExecutor(new YCmd());
        logger.info("Commands set.");
    }

    public static void initHelpFiles(final LinkedList<HelpFile> helpFile, final FileConfiguration config) {
        helpFile.add(new HelpFile("/help [page]", "Displays these help pages.", "udsplugin.help", "", ""));
        helpFile.add(new HelpFile("/help chat", "View more chat commands.", "udsplugin.any", "", ""));
            helpFile.add(new HelpFile("/a", "Toggle admin chat.", "udsplugin.a", "", "chat"));
            helpFile.add(new HelpFile("/b <message>", "Send a server message.", "udsplugin.b", "", "chat"));
            helpFile.add(new HelpFile("/c", "Toggle clan chat.", "udsplugin.c", "", "chat"));
            helpFile.add(new HelpFile("/p", "Toggle private chat.", "udsplugin.p", "", "chat"));
            helpFile.add(new HelpFile("/private <name>", "Open, join or leave a private chat room.", "udsplugin.private", "", "chat"));
            helpFile.add(new HelpFile("/r <message>", "Quick replay to a whisper.", "udsplugin.r", "", "chat"));
            helpFile.add(new HelpFile("/msg <player> <message>", "Send a private message.", "udsplugin.tell", "", "chat"));
        helpFile.add(new HelpFile("/help city", "View more city commands.", "udsplugin.help.city", "", ""));
            helpFile.add(new HelpFile("/city banish <city> <player>", "Remove a player from your city.", "udsplugin.city.banish", "", "city"));
            helpFile.add(new HelpFile("/city invite <city> <player>", "Invite a player to your city.", "udsplugin.city.invite", "", "city"));
            helpFile.add(new HelpFile("/city leave <city>", "Leave a city.", "udsplugin.city.leave", "", "city"));
            helpFile.add(new HelpFile("/city new <name>", "Start a new city.", "udsplugin.city.new", "", "city"));
            helpFile.add(new HelpFile("/city set <city>", "Set the warp to your city.", "udsplugin.city.set", "", "city"));
            helpFile.add(new HelpFile("/city warp <city>", "Warp to a city.", "udsplugin.city.warp", "", "city"));
        helpFile.add(new HelpFile("/help clan", "View more clan commands.", "udsplugin.help.clan", "", ""));
            helpFile.add(new HelpFile("/clan base", "Teleport to your clan base.", "udsplugin.clan.base.tp", "", "clan"));
            helpFile.add(new HelpFile("/clan base make", "Start a clan base.", "udsplugin.clan.base.make", "", "clan"));
            helpFile.add(new HelpFile("/clan base clear", "Remove a clan base.", "udsplugin.clan.base.clear", "", "clan"));
            helpFile.add(new HelpFile("/clan base set", "Set the warp point of your base.", "udsplugin.clan.base.set", "", "clan"));
            helpFile.add(new HelpFile("/clan disband <clan>", "Close down a clan.", "udsplugin.clan.disband", "", "clan"));
            helpFile.add(new HelpFile("/clan invite <player>", "Invite a player to join your clan.", "udsplugin.clan.invite", "", "clan"));
            helpFile.add(new HelpFile("/clan kick <player>", "Kick a player out of your clan.", "udsplugin.clan.kick", "", "clan"));
            helpFile.add(new HelpFile("/clan leave", "Leave your clan.", "udsplugin.clan.leave", "", "clan"));
            helpFile.add(new HelpFile("/clan list", "View a list of clans.", "udsplugin.clan.list", "", "clan"));
            helpFile.add(new HelpFile("/clan members [clan]", "List the members of a clan.", "udsplugin.clan.members", "", "clan"));
            helpFile.add(new HelpFile("/clan new <name>", "Start a new clan. " + config.getInt("cost.clan") + " " + config.getString("currency.plural"), "udsplugin.clan.new", "", "clan"));
            helpFile.add(new HelpFile("/clan owner <player>", "Set the owner of your clan.", "udsplugin.clan.owner", "", "clan"));
            helpFile.add(new HelpFile("/clan owner <clan> <player>", "Set the owner of a clan.", "udsplugin.clan.owner.any", "", "clan"));
            helpFile.add(new HelpFile("/clan rename <name>", "Rename your clan. " + config.getInt("cost.clan") + " " + config.getString("currency.plural"), "udsplugin.clan.rename", "", "clan"));
            helpFile.add(new HelpFile("/clan stats <clan>", "View detailed clan stats.", "udsplugin.clan.stats", "", "clan"));
        helpFile.add(new HelpFile("/help home", "View more home commands.", "udsplugin.help.home", "", ""));
            helpFile.add(new HelpFile("/home add <player>", "Add a room mate.", "udsplugin.home.add", "", "home"));
            helpFile.add(new HelpFile("/home boot", "Boot all players out of your house.", "udsplugin.home.boot", "", "home"));
            helpFile.add(new HelpFile("/home boot <player>", "Boot a player out of your house.", "udsplugin.home.boot", "", "home"));
            helpFile.add(new HelpFile("/home clear", "Remove you home protection.", "udsplugin.home.clear", "", "home"));
            helpFile.add(new HelpFile("/home expand <direction>", "Expand your home region.", "udsplugin.home.expand", "", "home"));
            helpFile.add(new HelpFile("/home kick <player>", "Remove a room mate.", "udsplugin.home.kick", "", "home"));
            helpFile.add(new HelpFile("/home lock", "Lock your doors and buttons etc.", "udsplugin.home.lock", "", "home"));
            helpFile.add(new HelpFile("/home make", "Set up home protection. " + config.getInt("cost.home") + " " + config.getString("currency.plural"), "udsplugin.home.make", "", "home"));
            helpFile.add(new HelpFile("/home roomies", "List your room mates.", "udsplugin.home.roomies", "", "home"));
            helpFile.add(new HelpFile("/home sell <player> <amount>", "Sell your home.", "udsplugin.home.sell", "", "home"));
            helpFile.add(new HelpFile("/home set", "Set your home spawn point.", "udsplugin.home.set", "", "home"));
            helpFile.add(new HelpFile("/home", "Teleport to your home point.", "udsplugin.home.tp", "", "home"));
            helpFile.add(new HelpFile("/home <player>", "Teleport to a room mates home point.", "udsplugin.home.tp.other", "", "home"));
            helpFile.add(new HelpFile("/home unlock", "Unlock your doors and buttons etc.", "udsplugin.home.unlock", "", "home"));
        helpFile.add(new HelpFile("/help money", "View more money commands.", "udsplugin.help.money", "", ""));
            helpFile.add(new HelpFile("/money", "Check your balance.", "udsplugin.money.balance", "", "money"));
            helpFile.add(new HelpFile("/money <player>", "Check another players balance.", "udsplugin.money.other", "", "money"));
            helpFile.add(new HelpFile("/money grant <player> <amount>", "Add money to a player.", "udsplugin.money.grant", "", "money"));
            helpFile.add(new HelpFile("/money pay <player> <amount>", "Pay a player.", "udsplugin.money.pay", "", "money"));
            helpFile.add(new HelpFile("/money prices", "Check various server prices.", "udsplugin.money.prices", "", "money"));
            helpFile.add(new HelpFile("/money rank", "View the top 5 players.", "udsplugin.money.rank", "", "money"));
            helpFile.add(new HelpFile("/money set <player> <amount>", "Set a players balance.", "udsplugin.money.set", "", "money"));
        helpFile.add(new HelpFile("/help pet", "View more pet commands.", "udsplugin.help.pet", "", ""));
            helpFile.add(new HelpFile("Select a pet", "Crouch and right click.", "udsplugin.pet.give", "", "pet"));
            helpFile.add(new HelpFile("/pet give <player>", "Give your pet to another player.", "udsplugin.pet.give", "", "pet"));
            helpFile.add(new HelpFile("/pet sell <player> <amount>", "Sell your pet to another player.", "udsplugin.pet.sell", "", "pet"));
        helpFile.add(new HelpFile("/help region", "View more region commands.", "udsplugin.help.region", "", ""));
            helpFile.add(new HelpFile("/region addmember <region> <player>", "Add a member.", "udsplugin.region.addmember", "", "region"));
            helpFile.add(new HelpFile("/region del <region>", "Delete a region.", "udsplugin.region.del", "", "region"));
            helpFile.add(new HelpFile("/region delmember <region> <player>", "Remove a member.", "udsplugin.region.delmember", "", "region"));
            helpFile.add(new HelpFile("/region flag <region> <flag>", "Toggle a region flag.", "udsplugin.region.flag", "", "region"));
            helpFile.add(new HelpFile("/region info <region>", "View detailed region info.", "udsplugin.region.info", "", "region"));
            helpFile.add(new HelpFile("/region list", "List all regions on the server.", "udsplugin.region.list", "", "region"));
            helpFile.add(new HelpFile("/region owner <region> [player]", "Set the owner of a region.", "udsplugin.region.owner", "", "region"));
            helpFile.add(new HelpFile("/region portal <name> <warp>", "Set a region as a portal.", "udsplugin.region.portal", "", "region"));
            helpFile.add(new HelpFile("/region quarry <block>:<data>", "Add a respawnable quarry.", "udsplugin.region.quarry", "", "region"));
            helpFile.add(new HelpFile("/region rename <region> <name>", "Rename a region.", "udsplugin.region.rename", "", "region"));
            helpFile.add(new HelpFile("/region reset <region>", "Set new coordinates.", "udsplugin.region.reset", "", "region"));
            helpFile.add(new HelpFile("/region select <region>", "Select a regions coordinates.", "udsplugin.region.select", "", "region"));
            helpFile.add(new HelpFile("/region set <name> [owner]", "Add a new region.", "udsplugin.region.set", "", "region"));
            helpFile.add(new HelpFile("/region tp <region>", "Teleport to the center of a region.", "udsplugin.region.tp", "", "region"));
            helpFile.add(new HelpFile("/region vert", "Extend the selection from bedrock to sky.", "udsplugin.region.vert", "", "region"));
        helpFile.add(new HelpFile("/help server", "View more server commands.", "udsplugin.help.server", "", ""));
            helpFile.add(new HelpFile("/server info", "View information about the server.", "udsplugin.server.info", "", "server"));
            helpFile.add(new HelpFile("/server stats", "Display server statisitics.", "udsplugin.server.stats", "", "server"));
            helpFile.add(new HelpFile("/server stop", "Stop the server.", "udsplugin.server.stop", "", "server"));
        helpFile.add(new HelpFile("/help shop", "View more shop commands.", "udsplugin.help.shop", "", ""));
            helpFile.add(new HelpFile("/shop buy", "Buy a shop plot. " + config.getInt("cost.shop") + " " + config.getString("currency.plural"), "udsplugin.shop.", "", "shop"));
            helpFile.add(new HelpFile("/shop clear", "Put a shop plot back up for sale.", "udsplugin.shop.clear", "", "shop"));
            helpFile.add(new HelpFile("/shop del", "Delete the shop plot you are in.", "udsplugin.shop.del", "", "shop"));
            helpFile.add(new HelpFile("/shop fire <player>", "Fire an employee.", "udsplugin.shop.fire", "", "shop"));
            helpFile.add(new HelpFile("/shop hire <player>", "Hire an employee.", "udsplugin.shop.hire", "", "shop"));
            helpFile.add(new HelpFile("/shop item", "Shows the name of the item in your hand.", "udsplugin.shop.item", "", "shop"));
            helpFile.add(new HelpFile("/shop make", "Make a new shop plot.", "udsplugin.shop.make", "", "shop"));
            helpFile.add(new HelpFile("/shop sell <player> <amount>", "Sell your shop to a player.", "udsplugin.shop.sell", "", "shop"));
            helpFile.add(new HelpFile("/shop set", "Use WE stick to set a new shop plot.", "udsplugin.shop.set", "", "shop"));
            helpFile.add(new HelpFile("/shop sign", "Check how to format a shop sign.", "udsplugin.shop.sign", "", "shop"));
            helpFile.add(new HelpFile("/shop tp", "Teleport to your shop (may bug).", "udsplugin.shop.tp", "", "shop"));
            helpFile.add(new HelpFile("/shop tp <player>", "Teleport to a players shop (may bug).", "udsplugin.shop.tp.other", "", "shop"));
            helpFile.add(new HelpFile("/shop workers", "Show your employees and employers.", "udsplugin.shop.workers", "", "shop"));
        helpFile.add(new HelpFile("/help we", "View more WorldEdit commands.", "udsplugin.help.we", "", ""));
            helpFile.add(new HelpFile("/we drain <radius>", "Drain liquids near you.", "udsplugin.we.drain", "", "we"));
            helpFile.add(new HelpFile("/we ext <radius>", "Put out fires near you.", "udsplugin.we.ext", "", "we"));
            helpFile.add(new HelpFile("/we move <up|down> <distance>", "Move blocks.", "udsplugin.we.move", "", "we"));
            helpFile.add(new HelpFile("/we regen", "Regenerate an area from seed.", "udsplugin.we.regen", "", "we"));
            helpFile.add(new HelpFile("/we replace <from> <to>", "Replace blocks.", "udsplugin.we.replace", "", "we"));
            helpFile.add(new HelpFile("/we set <block>", "Set blocks.", "udsplugin.we.set", "", "we"));
            helpFile.add(new HelpFile("/we undo", "Undo the last /we command.", "udsplugin.we.undo", "", "we"));
        helpFile.add(new HelpFile("/help warden", "View more warden commands.", "udsplugin.help.warden", "", ""));
            helpFile.add(new HelpFile("/jail <player> <time> [fine]", "Jail a player.", "udsplugin.jail", "", "warden"));
            helpFile.add(new HelpFile("/unjail <player>", "Unjail a player.", "udsplugin.unjail", "", "warden"));
        helpFile.add(new HelpFile("/help mod", "View more mod commands.", "udsplugin.help.mod", "", ""));
            helpFile.add(new HelpFile("/ban <player> [reason]", "Ban a player from the server.", "udsplugin.ban", "", "mod"));
            helpFile.add(new HelpFile("/blind <player>", "Spawn fake experience orbs on a player.", "udsplugin.fun.blind", "", "mod"));
            helpFile.add(new HelpFile("/butcher [all]", "Kill all mobs around you.", "udsplugin.butcher", "", "mod"));
            helpFile.add(new HelpFile("/day", "Make it day time.", "udsplugin.day", "", "mod"));
            helpFile.add(new HelpFile("/default <player>", "Set a player to default.", "udsplugin.default", "", "mod"));
            helpFile.add(new HelpFile("/delwarp <warp>", "Delete a warp point.", "udsplugin.delwarp", "", "mod"));
            helpFile.add(new HelpFile("/enchant <enchantment> <level>", "Enchant an item.", "udsplugin.enchant", "", "mod"));
            helpFile.add(new HelpFile("/firework", "Shoot a live TNT where you are looking.", "udsplugin.firework", "", "mod"));
            helpFile.add(new HelpFile("/god [player]", "Toggle a players god mode.", "udsplugin.god", "", "mod"));
            helpFile.add(new HelpFile("/heal [player]", "Heal a player.", "udsplugin.heal", "", "mod"));
            helpFile.add(new HelpFile("/setarmor <item>:<data>", "Place an item on your head.", "udsplugin.fun.setarmor", "", "mod"));
            helpFile.add(new HelpFile("/invsee [player]", "View another players inventory.", "udsplugin.invsee", "", "mod"));
            helpFile.add(new HelpFile("/kick <player> [reason]", "Kick a player off the server.", "udsplugin.kick", "", "mod"));
            helpFile.add(new HelpFile("/member <player>", "Set a player to member.", "udsplugin.member", "", "mod"));
            helpFile.add(new HelpFile("/modeme", "Safety feature to set yourself to mod.", "udsplugin.modme", "", "mod"));
            helpFile.add(new HelpFile("/nick [player] [name]", "Give a player a nickname.", "udsplugin.nick", "", "mod"));
            helpFile.add(new HelpFile("/night", "Make it night time.", "udsplugin.night", "", "mod"));
            helpFile.add(new HelpFile("/rain", "Make it rain.", "udsplugin.rain", "", "mod"));
            helpFile.add(new HelpFile("/resetquarry", "Force quarry resets on server.", "udsplugin.quarryreset", "", "mod"));
            helpFile.add(new HelpFile("/setwarp <warp> [rank]", "Set a new warp point.", "udsplugin.setwarp", "", "mod"));
            helpFile.add(new HelpFile("/signs", "View the special signs you can place.", "udsplugin.signs", "", "mod"));
            helpFile.add(new HelpFile("/spawner", "Set the mob of a mob spawner.", "udsplugin.spawner", "", "mod"));
            helpFile.add(new HelpFile("/storm [duration]", "Set the weather to stormy.", "udsplugin.storm", "", "mod"));
            helpFile.add(new HelpFile("/sun", "Stop the rain.", "udsplugin.sun", "", "mod"));
            helpFile.add(new HelpFile("/tgm [player]", "Toggle a player's game mode.", "udsplugin.tgm", "", "mod"));
            helpFile.add(new HelpFile("/tp [player] <player>", "Teleport players to each other.", "udsplugin.tp", "", "mod"));
            helpFile.add(new HelpFile("/unban <player>", "Unban a player from the server.", "udsplugin.unban", "", "mod"));
            helpFile.add(new HelpFile("/unnick [player]", "Remove a players nickname.", "udsplugin.unnick", "", "mod"));
            helpFile.add(new HelpFile("/warden <player>", "Set a player to warden.", "udsplugin.warden", "", "mod"));
            helpFile.add(new HelpFile("/xp <player> <amount>", "Grant a player experience levels.", "udsplugin.xp", "", "mod"));
        helpFile.add(new HelpFile("/help admin", "View more admin commands.", "udsplugin.help.admin", "", ""));
            helpFile.add(new HelpFile("/admin <player>", "Set a player to admin.", "udsplugin.admin", "", "admin"));
            helpFile.add(new HelpFile("/adminme", "Safety feature to set yourself to admin.", "udsplugin.adminme", "", "admin"));
            helpFile.add(new HelpFile("/giveperm <player> <perm> <true|false>", "Set a permission.", "udsplugin.giveperm", "", "admin"));
            helpFile.add(new HelpFile("/lockdown [player]", "Put the server in lockdown.", "udsplugin.lockdown", "", "admin"));
            helpFile.add(new HelpFile("/mod <player>", "Set a player to mod.", "udsplugin.mod", "", "admin"));
            helpFile.add(new HelpFile("/setperm <group> <perm> <true|false>", "Set a permission.", "udsplugin.setperm", "", "admin"));
            helpFile.add(new HelpFile("/setspawn", "Set the spawn location of the server.", "udsplugin.setspawn", "", "admin"));
            helpFile.add(new HelpFile("/timereset", "Reset the server's internal day counter.", "udsplugin.timereset", "", "admin"));
            helpFile.add(new HelpFile("/udsreload", "Reload the config.yml.", "udsplugin.udsreload", "", "admin"));
        helpFile.add(new HelpFile("/acceptrules", "Accept the rules to promote yourself. " + config.getInt("cost.build") + " " + config.getString("currency.plural"), "udsplugin.acceptrules", "", ""));
        helpFile.add(new HelpFile("/back", "Teleport to a previous location.", "udsplugin.back", "", ""));
        helpFile.add(new HelpFile("/bounty", "Check bounties.", "udsplugin.bounty", "", ""));
        helpFile.add(new HelpFile("/bounty <player> <amount>", "Place a bounty on a player.", "udsplugin.bounty", "", ""));
        helpFile.add(new HelpFile("/bounty remove <player>", "Remove a bounty from a player.", "udsplugin.bounty.remove", "", ""));
        helpFile.add(new HelpFile("/call <player>", "Request to teleport to another player.", "udsplugin.call", "", ""));
        helpFile.add(new HelpFile("/challenge <player> <wager>", "Challenge a player to a fight.", "udsplugin.challenge", "", ""));
        helpFile.add(new HelpFile("/check", "Teleport back to a checkpoint.", "udsplugin.check", "", ""));
        helpFile.add(new HelpFile("/ci", "Delete the contents of your inventory.", "udsplugin.ci", "", ""));
        helpFile.add(new HelpFile("/debug <command>", "Extra commands for server debugging.", "udsplugin.debug", "", ""));
        helpFile.add(new HelpFile("/dynmap hide", "Hide yourself on the live map.", "dynmap.hide", "", ""));
        helpFile.add(new HelpFile("/dynmap show", "Show yourself on the live map.", "dynmap.show", "", ""));
        helpFile.add(new HelpFile("/face", "Get a compass reading.", "udsplugin.face", "", ""));
        helpFile.add(new HelpFile("/face <direction>", "Turn to face a direction.", "udsplugin.face", "", ""));
        helpFile.add(new HelpFile("/gift <player> <message>", "Gift an item.", "udsplugin.gift", "", ""));
        helpFile.add(new HelpFile("/i <item>:<data> <amount>", "Spawn items.", "udsplugin.i", "", ""));
        helpFile.add(new HelpFile("/ignore <player>", "Ignore a player until log off.", "udsplugin.ignore", "", ""));
        helpFile.add(new HelpFile("/kit [name]", "Buy a tool kit.", "udsplugin.kit", "", ""));
        helpFile.add(new HelpFile("/map", "Buy a map.", "udsplugin.map", "", ""));
        helpFile.add(new HelpFile("/mapdupe", "Duplicate the map you are holding.", "udsplugin.mapdupe", "", ""));
        helpFile.add(new HelpFile("/me <action>", "Send an action.", "udsplugin.me", "", ""));
        helpFile.add(new HelpFile("/n", "Refuse a request.", "udsplugin.n", "", ""));
        helpFile.add(new HelpFile("/ownerme", "Safety feature to set yourself to owner.", "udsplugin.ownerme", "", ""));
        helpFile.add(new HelpFile("/paybail", "Pay bail to get out of jail.", "udsplugin.paybail", "", ""));
        helpFile.add(new HelpFile("/powertool <command>", "Right click the air to use this command.", "udsplugin.powertool", "", ""));
        helpFile.add(new HelpFile("/rules", "Display the server rules.", "udsplugin.rules", "", ""));
        helpFile.add(new HelpFile("/scuba", "Toggle your scuba gear.", "udsplugin.scuba", "", ""));
        helpFile.add(new HelpFile("/sit", "Sit on a stair block.", "udsplugin.sit", "", ""));
        helpFile.add(new HelpFile("/spawn", "Teleport to the spawn point.", "udsplugin.spawn", "", ""));
        helpFile.add(new HelpFile("/stack", "Put items in your inventory into full stacks.", "udsplugin.stack", "", ""));
        helpFile.add(new HelpFile("/stats <player>", "View a player's play time stats.", "udsplugin.stats", "", ""));
        helpFile.add(new HelpFile("/swearjar", "Tells how many credits are in the swear jar.", "udsplugin.swearjar", "", ""));
        helpFile.add(new HelpFile("/ticket <problem|suggestion>", "Submit a ticket to the developer.", "udsplugin.ticket", "", ""));
        helpFile.add(new HelpFile("/vip", "Rent VIP status. " + config.getInt("cost.vip") + " " + config.getString("currency.plural"), "udsplugin.vip", "", ""));
        helpFile.add(new HelpFile("/warp", "View a list of available warps.", "udsplugin.warp", "", ""));
        helpFile.add(new HelpFile("/warp <warp>", "Teleport to a warp point.", "udsplugin.warp", "", ""));
        helpFile.add(new HelpFile("/where", "View some simple details about your location.", "udsplugin.where", "", ""));
        helpFile.add(new HelpFile("/who", "View a list of online players.", "udsplugin.who", "", ""));
        helpFile.add(new HelpFile("/whois <nick>", "Find a players real Minecraft username.", "udsplugin.whois", "", ""));
        helpFile.add(new HelpFile("/y", "Accept a request.", "udsplugin.y", "", ""));
    }
}
